<div [@routerTransition]>
    <div class="content d-flex flex-column flex-column-fluid">
        <sub-header [title]="'QuantityList' | localize" [description]="'QuantityList' | localize">
            <div role="actions">
                <button class="btn btn-primary" (click)="creteSkuRfid()">
                    <i class="fa fa-plus"></i>{{l('createSkuRfid')}}
                </button>
                <button class="btn btn-primary" (click)="showRfid()">
                    <i class="icon-shangpinguanli"></i> {{l('showAll')}} </button>
                <button class="btn btn-primary" (click)="goImport()">
                    <i class="icon-excel"></i> {{l('import')}} </button>
            </div>
        </sub-header>


        <div [class]="containerClass">
            <div class="card card-custom gutter-b">
                <div class="card-body">
                    <div class="row align-items-center mb-4">
                        <div class="col-2">
                            <label>sku{{l('name')}}</label>
                            <div class="form-group">
                                <div class="input-group">
                                    <input [(ngModel)]="filter" name="filter" (keyup.enter)="getList()" autoFocus
                                        class="form-control m-input" type="text">
                                </div>
                            </div>
                        </div>
                        <div class="col-2">
                            <label>rfid{{l('itemId')}}</label>
                            <div class="form-group">
                                <div class="input-group">
                                    <input [(ngModel)]="rfid" name="rfid" (keyup.enter)="getList()"
                                        class="form-control m-input" type="text">
                                </div>
                            </div>
                        </div>

                        <div class="col-3" style="position:relative;padding-bottom: 0;top:-0.6rem;">
                            <app-high-tree #highTree
                                [selfConfig]="{labelName:l('belongStore'),searchDepth:'store',includeOfflineStore:true}"
                                (onTreeUpdate)="onTreeUpdate($event)"></app-high-tree>
                        </div>

                        <div class="col-2">
                            <div class="form-group m-form__group align-items-center">
                                <label>&nbsp;</label>
                                <div class="input-group">
                                    <button type="button" class="btn btn-primary"
                                        [buttonBusy]="primengTableHelper.isLoading" (click)="getList()">
                                        <i class="la la-refresh"></i>
                                        {{l("search")}}
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>



                    <div class="row align-items-center">
                        <!--<Primeng-Datatable-Start>-->
                        <div class="primeng-datatable-container" [busyIf]="primengTableHelper.isLoading">
                            <p-table #dataTable (onLazyLoad)="getList($event)" [value]="primengTableHelper.records"
                                [rows]="primengTableHelper.defaultRecordsCountPerPage" [paginator]="false" [lazy]="true"
                                [resizableColumns]="primengTableHelper.resizableColumns"
                                [responsive]="primengTableHelper.isResponsive">
                                <ng-template pTemplate="header">
                                    <tr>
                                        <th style="width: 15%">{{l('Actions')}}</th>
                                        <th style="width:5%">{{l('RecordId')}}</th>
                                        <th>{{l('name')}}</th>
                                        <th>{{l('Picture')}}</th>
                                        <th pSortableColumn="quantity">{{l('num')}}
                                            <p-sortIcon field="quantity"></p-sortIcon>
                                        </th>
                                        <th pSortableColumn="rfideCount">rfid{{l('amount')}}
                                            <p-sortIcon field="rfideCount"></p-sortIcon>
                                        </th>
                                    </tr>

                                </ng-template>
                                <ng-template pTemplate="body" let-record let-i="rowIndex">
                                    <tr [pSelectableRow]="record" [attr.trid]="record.id">
                                        <td>
                                            <div class="btn-group dropdown" dropdown normalizePosition>
                                                <button class="dropdown-toggle btn btn-sm btn-primary"
                                                    data-toggle="dropdown" dropdownToggle aria-haspopup="true"
                                                    aria-expanded="false">
                                                    <i class="fa fa-cog"></i>
                                                    <span class="caret"></span> {{l("Actions")}}
                                                </button>
                                                <ul class="dropdown-menu" *dropdownMenu>
                                                    <li>
                                                        <a (click)="showDetail(record)"
                                                            class="icon-1311shangpinfenleipicishuxing dropdown-item">{{l("num")}}{{l("detail")}}</a>
                                                    </li>
                                                    <li>
                                                        <a (click)="showRfid(record.id)"
                                                            class="icon-shangpinguanli dropdown-item">{{l("rfid")}}{{l("detail")}}</a>
                                                    </li>
                                                </ul>
                                            </div>
                                        </td>
                                        <td style="width:5%"> {{transIndex(i)}}</td>
                                        <td>
                                            <span>{{record.title}}</span>
                                        </td>
                                        <td>
                                            <img [src]="fixFileUrl(record.picUrl)" style="width: 33px;"
                                                (error)="fixPic($event)" />
                                        </td>
                                        <td>
                                            <span>{{record.quantity}}</span>
                                        </td>
                                        <td>
                                            <span>{{record.rfideCount}}</span>
                                        </td>
                                    </tr>
                                </ng-template>
                                <ng-template pTemplate="emptymessage" let-records>
                                    <tr *ngIf="primengTableHelper.records">
                                        <td colspan="6">
                                            <img class="emptymessage"
                                                src="/assets/common/images/placeholder/deviceHolder.png" />
                                        </td>
                                    </tr>
                                </ng-template>
                            </p-table>
                            <div class="primeng-paging-container">
                                <p-paginator [rows]="primengTableHelper.defaultRecordsCountPerPage" #paginator
                                    (onPageChange)="getList($event)"
                                    [totalRecords]="primengTableHelper.totalRecordsCount"
                                    [rowsPerPageOptions]="primengTableHelper.predefinedRecordsCountPerPage">
                                </p-paginator>
                                <span class="total-records-count">
                                    {{l('TotalRecordsCount', primengTableHelper.totalRecordsCount)}}
                                </span>
                            </div>
                        </div>
                        <!--<Primeng-Datatable-End>-->
                    </div>
                </div>
            </div>
        </div>

        <outputinDetailModal #outputinDetailModal></outputinDetailModal>
        <rfidListModal #rfidListModal></rfidListModal>
        <createOrEditSkuRfidModal #createOrEditSkuRfidModal (modalSave)="getList()"></createOrEditSkuRfidModal>
    </div>

</div>